<?php

require_once 'model/layout.class.php';

class Core_Table_Layout extends Database_Table
{
	protected $_name = 'appearance_layout';

	protected $_rowClass = 'Core_Table_Model_Layout';

	/**
	 * Load structure by theme
	 * @param   string  $theme
	 * @return  default
	 */
	function loadForRender($theme)
	{
		$db = $this -> getAdapter();

		$theme = $db -> quote($theme, 'string');

		$sql = "SELECT concat(section_key,':',action_id) AS name, layout_id as value FROM :table WHERE theme_id IN($theme,'default') AND is_enabled=1";

		$sql = strtr($sql, array(':table' => $this -> getName()));

		return $this -> getAdapter() -> fetchPairs($sql);
	}

	

}
